/*
 * HardwareInit.h
 *
 * Created: 10.07.2012 20:17:06
 *  Author: Martin
 */ 


#ifndef HARDWAREINIT_H_
#define HARDWAREINIT_H_

void hardware_init()
{
	// Port A

	PORTA 	=		(0 << DI_TLC) 		// !Pullup
	|		(0 << DO_TLC) 		// Off
	|		(0 << SCK_TLC) 		// Off
	|		(1 << Sel_Col1)		// Pullup
	|		(1 << Sel_Col0)		// Pullup
	|		(0 << Mode)			// !Pullup
	|		(0 << Blank) 		// !Pullup
	|		(0 << XLAT); 		// !Pullup
	
	DDRA 	=		(0 << DI_TLC) 		//In
	|		(1 << DO_TLC) 		//Out
	|		(1 << SCK_TLC) 		//Out
	|		(0 << Sel_Col1)		//In
	|		(0 << Sel_Col0)		//In
	|		(Mode_IO << Mode)			//In
	|		(0 << Blank) 		//In
	|		(0 << XLAT); 		//In

	// Port B

	PORTB 	=		(0 << DI_Layer)		// !Pullup
	|		(1 << DO_Layer)		// Off
	|		(0 << SCK_Layer)	// !Pullup
	|		(0 << Ready)		// Off
	|		(0 << Chip_Sel);	// !Pullup
	
	DDRB 	=		(0 << DI_Layer)		// In
	|		(1 << DO_Layer)		// Out
	|		(0 << SCK_Layer)	// In
	|		(1 << Ready)		// Out
	|		(0 << Chip_Sel);	// In

	// MCU Control Register
	
	MCUCR	=		(1 << ISC01)		// Rising edge of INT0 & INT1
	|		(1 << ISC00);		// generates interrupt request
	
	
}



#endif /* HARDWAREINIT_H_ */